package cc.yugu.yhdw.common.domain.hdw;

import cc.yugu.yhdw.common.annotation.Transient;
import cc.yugu.yhdw.common.domain.LongIdEntity;
import cc.yugu.yhdw.common.entity.json.DateTimeSerializer;
import org.codehaus.jackson.map.annotate.JsonSerialize;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
 * 换电套餐
 *
 * @Date:Created in 2018/7/2 18:10
 * @Author:
 * @Modified By: zxj 2018/7/2 18:10
 */
public class ExchangePacket extends LongIdEntity {

    public enum Type {
        CODE_1(1, "按次数"),
        CODE_2(2, "按时段"),;

        private final int value;
        private final String name;

        private Type(int value, String name) {
            this.value = value;
            this.name = name;
        }

        private static Map<Integer, String> map = new HashMap<Integer, String>();

        static {
            for (Type e : Type.values()) {
                map.put(e.getValue(), e.getName());
            }
        }

        public static String getName(int value) {
            return map.get(value);
        }

        public int getValue() {
            return value;
        }

        public String getName() {
            return name;
        }
    }
    public String getTypeName() {
        if(type != null) {
            return Type.getName(type);
        }
        return "";
    }
    String priceName;
    Integer agentId;  // 运营商id

    Integer agencyId; // 代理商id （new） --zxj in 20180727 for 权限设计

    Integer type;
    Integer dayCount;
    Integer number;
    Integer price;
    Integer dayUse;
    String memo;
    Date createTime;
    @Transient
    String agentName;
    @Transient
    String agencyName; // 代理商名称 --zxj in 20180727 for 权限设计

    public Integer getDayUse() {
        return dayUse;
    }

    public void setDayUse(Integer dayUse) {
        this.dayUse = dayUse;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Integer getNumber() {
        return number;
    }

    public void setNumber(Integer number) {
        this.number = number;
    }

    public String getMemo() {
        return memo;
    }

    public void setMemo(String memo) {
        this.memo = memo;
    }

    public Integer getPrice() {
        return price;
    }

    public void setPrice(Integer price) {
        this.price = price;
    }

    public Integer getDayCount() {
        return dayCount;
    }

    public void setDayCount(Integer dayCount) {
        this.dayCount = dayCount;
    }

    public String getPriceName() {
        return priceName;
    }

    public void setPriceName(String priceName) {
        this.priceName = priceName;
    }

    public Integer getAgentId() {
        return agentId;
    }

    public void setAgentId(Integer agentId) {
        this.agentId = agentId;
    }

    @JsonSerialize(using = DateTimeSerializer.class)
    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getAgentName() {
        return agentName;
    }

    public void setAgentName(String agentName) {
        this.agentName = agentName;
    }

    public Integer getAgencyId() {
        return agencyId;
    }

    public void setAgencyId(Integer agencyId) {
        this.agencyId = agencyId;
    }

    public String getAgencyName() {
        return agencyName;
    }

    public void setAgencyName(String agencyName) {
        this.agencyName = agencyName;
    }
}
